
"use strict"
var call = require("../../utils/request.js")
const app = getApp()
Page({
  data: {
    cards: [],
  
  },

  onLoad: function(e) {
    if (wx.getStorageSync("uid")) {
 
      var call = require("../../utils/request.js")
      var url = 'getcards?uid=' + wx.getStorageSync("uid");
      call.getData(url, this.getcards, this.fail)

    } else {

      setTimeout(() => {
        wx.showToast({
          title: '请先授权登录',
          icon: "none",
        });
        setTimeout(() => {
          wx.switchTab({
            url: '../mine/mine'
          })
        }, 2000)
      }, 0);
    }

  },
  
  
  duihuan: function (res) {

    wx.reLaunch({
      url: '../hoteldetail/duihuan',
    })
 
  },


  gourl: function (res) {

    wx.reLaunch({
      url: '../mine/godetail?id='+res.currentTarget.dataset.index,
    })
 
  },


  getcards: function (res) {
    console.log(res)
    this.setData({
      cards: res.data
    })

    console.log(this.data.cards)
 
  },
  gohome: function (data) {
    wx.reLaunch({
      url: '../index/index',
    })
  },



})